import { BaseItem2D } from "../BaseItem2D"
import { Main } from "../Main"

export class CollisionObj{
   offX=0
   offY=0
   width=100
   height=100
   //insert时自动计算
   x=0 
   y=0
   centerX=0
   centerY=0
   owner:BaseItem2D
   constructor(owner:BaseItem2D,width:number,height:number){
	   this.owner=owner
	   this.width=width
	   this.height=height
   }
   insert(){
	   this.centerX = this.owner.x
	   this.centerY =this.owner.y
	   this.x=this.offX+this.centerY-this.width/2
	   this.y=this.offY+this.centerX-this.height/2
	  
	   Main.I.collisionManager.insert(this)
   }
}


